<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>如何检测当前浏览器上的插件</title>
    
</head>
<body>
    <script type="text/javascript">
        function hasPlugin(name){
            // 如果有插件返回true
            name = name.toLowerCase();
            for(var i=0;i<navigator.plugins.length;i++){
                if(navigator.plugins[i].name.toLowerCase().indexOf(name) > -1){
                    // 有该插件
                    return true;
                }else{
                    return false;
                }
            }
        }
        alert(hasPlugin("PDF"));
        alert(hasPlugin("Flash"));
    </script>
</body>
</html>